/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.wanhai.itm.wditm141.service;

import com.wanhai.itm.util.LiveDataModel;
import com.wanhai.itm.util.LoadOption;
import com.wanhai.zkbase.core.WHL_BaseService;
import com.wanhai.zkbase.core.WHL_BaseVM;
import com.wanhai.zkbase.dao.IBaseDAO;
import com.wanhai.zkbase.dao.ProgramDAOImpl;
import java.util.List;

/**
 *
 * @author m2434
 */
public class WDITM141_Service extends WHL_BaseService {
    private IBaseDAO daoImpl = null;
    private LoadOption loadOption;
    
    public WDITM141_Service(WHL_BaseVM baseVM){
        super(baseVM);
        this.initService();
    }
    
    private void initService() {
        daoImpl = new ProgramDAOImpl(getBaseVM().getProgCode());
        loadOption = new LoadOption(daoImpl);
    } 
    
//    public ITM4001VO insert(ITM4001VO target) throws Exception{
//        
//        return daoImpl.update(target);
//    }
//    
//    public ITM4001VO update(ITM4001VO target) throws Exception{
//        
//        return daoImpl.update(target);
//    }
//    
//    public void delete(ITM4001VO target) throws Exception{
//        daoImpl.delete(target);
//    }
//    
//    //live data query
//    public LiveDataModel<ITM4001VO> queryLive(ITM4001VO cond, String orderBy) throws Exception{
//        LiveDataModel liveModel = new LiveDataModel<ITM4001VO>(daoImpl,cond);
//        liveModel.setPageSize(5);//指定每頁查出幾筆，與zul的分頁元件指定的pageSize要一致
//        liveModel.setOrderBy(orderBy);
//        
//        return liveModel;
//    }
//    
//    //normal query
//    public List<ITM4001VO> query(ITM4001VO cond) throws Exception{
//        return daoImpl.query(cond);
//    }
//    
//    //判斷要新增或修改的資料是否已存在DB
//    public List<ITM4001VO> isExist(ITM4001VO cond, String rowid) throws Exception{
//        List<ITM4001VO> resultList;
//        
//        if(rowid != null && !"".equals(rowid)){
//            resultList = daoImpl.query(cond, null, " rowid <> '"+rowid+"'", null);
//        }else{
//            resultList = daoImpl.query(cond);
//        }
//        
//        return resultList;
//    }

    public LoadOption getLoadOption() {
        return loadOption;
    }
}
